#尽量是最小镜像
FROM golang:1.17.2-alpine3.13
#设置运行目录
WORKDIR $GOPATH/src
#拷贝httpserver.go文件
COPY httpserver.go $GOPATH/src
RUN go build httpserver.go
ENV SERVICE_PORT = 8080
EXPOSE 8080
ENTRYPOINT ["./httpserver"]
#创建image：docker build -t homework:class.1009 .
#运行：docker run -d -p 8080:8080 --name goserver homework:class.1009
#推送dockerhub：
#docker tag homework:class.1009 korn519/homework:class.1009
#docker push korn519/homework:class.1009
